package ch.fhnw.qualiscan.api.output;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

import ch.fhnw.qualiscan.core.db.pojos.Domain;

@XmlRootElement
public class DomainsOutput {
	
	List<Domain> domains;
	List<DomainOutput> domainOutput;
	
	public DomainsOutput() {}
	
	public DomainsOutput(List<Domain> domains) {
		this.domains = domains;
	}
	
	@XmlElementWrapper(name="domains")
    public List<DomainOutput> getDomain() {
        if(domainOutput == null) {
        	domainOutput = new ArrayList<DomainOutput>();
        }
        
        if (domains != null) {
            for (Domain domain : domains) {
            	domainOutput.add(new DomainOutput(domain));
            }
        }

        return domainOutput;
    }
	
}
